<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

<f:subview id="dataContent">
    <h:form>
        <h:inputHidden value="#{PathBean.path}" immediate="true"/>

        <f:loadBundle basename="offset.nodes.server.view.ApplicationResource" var="msg"/>


        <h:panelGroup  rendered="#{DataBean.propertiesManager.pager.pagingRequired}">
            <h:commandLink actionListener="#{DataBean.propertiesManager.pager.first}">
                <h:graphicImage value="#{NodesBean.imagePath}/first.png"/>
            </h:commandLink>
            &nbsp;
            <h:commandLink actionListener="#{DataBean.propertiesManager.pager.previous}">
                <h:graphicImage value="#{NodesBean.imagePath}/previous.png"/>
            </h:commandLink>
            &nbsp;
            <h:commandLink actionListener="#{DataBean.propertiesManager.pager.next}">
                <h:graphicImage value="#{NodesBean.imagePath}/next.png"/>
            </h:commandLink>
            &nbsp;
            <h:commandLink actionListener="#{DataBean.propertiesManager.pager.last}">
                <h:graphicImage value="#{NodesBean.imagePath}/last.png"/>
            </h:commandLink>
        </h:panelGroup>   

        <br/>        

        <h:inputHidden value="#{DataBean.propertiesManager.pageStart}"/>
        <h:dataTable styleClass="table" value="#{DataBean.propertiesManager.result}" captionClass="dheading1" headerClass="header" rowClasses="even,odd" var="property" columnClasses="icon,firstColumn,secondColumn"
                     rendered="#{DataBean.propertiesManager.notEmpty}">
            <f:facet name="caption">
                <h:outputText value="#{msg.dataProperties}"/>
            </f:facet>

            <h:column>
                <f:facet name="header">
                    <h:outputText value=""/>
                </f:facet>
                <h:graphicImage value="#{NodesBean.repositoryPath}?propertyType=#{property.propertyType}&contentType=#{DataBean.iconContentType}" title="#{property.propertyTypeName}"/>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="#{msg.dataPropertiesName}"/>
                </f:facet>

                <h:outputText rendered="#{!property.referenceType}" value="#{property.name}"/>
                <h:outputLink rendered= "#{property.referenceType}" value="#{NodesBean.repositoryPath}#{property.reference}">
                    <h:outputText value="#{property.name}"/>
                </h:outputLink>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="#{msg.dataPropertiesValue}"/>
                </f:facet>
                <h:outputText value="#{property.string}"/>
            </h:column>
        </h:dataTable>

        <br/>

        <h:panelGroup rendered="#{DataBean.nodesManager.pager.pagingRequired}">
            <h:commandLink actionListener="#{DataBean.nodesManager.pager.first}">
                <h:graphicImage value="#{NodesBean.imagePath}/start.png"/>
            </h:commandLink>
            &nbsp;
            <h:commandLink actionListener="#{DataBean.nodesManager.pager.previous}">
                <h:graphicImage value="#{NodesBean.imagePath}/previous.png"/>
            </h:commandLink>
            &nbsp;
            <h:commandLink actionListener="#{DataBean.nodesManager.pager.next}">
                <h:graphicImage value="#{NodesBean.imagePath}/next.png"/>
            </h:commandLink>
            &nbsp;
            <h:commandLink actionListener="#{DataBean.nodesManager.pager.last}">
                <h:graphicImage value="#{NodesBean.imagePath}/end.png"/>
            </h:commandLink>
        </h:panelGroup>

        <br/>     

        <h:inputHidden value="#{DataBean.nodesManager.pageStart}"/>
        <h:dataTable value="#{DataBean.nodesManager.result}" styleClass="table" captionClass="dheading1" headerClass="header" rowClasses="even,odd" var="node" columnClasses="icon,firstColumn,secondColumn"
                     rendered="#{DataBean.nodesManager.notEmpty}">
            <f:facet name="caption">
                <h:outputText value="#{msg.dataNodes}"/>
            </f:facet>

            <h:column>
                <f:facet name="header">
                    <h:outputText value=""/>
                </f:facet>
                <h:graphicImage value="#{NodesBean.repositoryPath}?nodeType=#{node.primaryNodeType.name}&contentType=#{DataBean.iconContentType}"/>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="#{msg.dataNodesName}" />
                </f:facet>
                <h:outputLink value="#{NodesBean.repositoryPath}#{node.path}">
                    <h:outputText value="#{node.name}" styleClass="table"/>
                </h:outputLink>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="#{msg.dataNodesType}" />
                </f:facet>
                <h:outputLink value="#{NodesBean.repositoryPath}#{node.path}?contentType=data">
                    <h:outputText value="#{node.primaryNodeType.name}" styleClass="table"/>
                </h:outputLink>
            </h:column>
        </h:dataTable>


    </h:form>

</f:subview>